<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>景点介绍 - 汉中旅游</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="css/style.css">
    <style>
        .page-header {
            background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('img/attractions/hanzhongfengguang.jpg');
            background-size: cover;
            background-position: center;
            color: white;
            text-align: center;
            padding: 100px 0;
        }
        
        .page-header h1 {
            font-size: 36px;
            margin-bottom: 20px;
        }
        
        .page-header p {
            font-size: 18px;
            margin: 0 auto;
        }
        
        .category-nav {
            display: flex;
            justify-content: center;
            gap: 30px;
            margin-bottom: 40px;
        }
        
        .category-link {
            text-decoration: none;
            color: #333;
            text-align: center;
            transition: all 0.3s;
        }
        
        .category-link:hover {
            transform: translateY(-5px);
        }
        
        .category-icon {
            width: 80px;
            height: 80px;
            background-color: #e74c3c;
            color: white;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0 auto 10px;
            font-size: 30px;
            transition: all 0.3s;
        }
        
        .category-link:hover .category-icon {
            background-color: #c0392b;
        }
        
        .category-link span {
            font-size: 16px;
            font-weight: bold;
        }
        
        .section-padding {
            padding: 40px 0;
        }
        
        .attractions-grid {
            display: flex;
            flex-direction: column;
            gap: 40px;
        }
        
        .attraction-item {
            display: flex;
            background-color: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }
        
        .attraction-image {
            flex: 0 0 40%;
            overflow: hidden;
        }
        
        .attraction-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.5s;
        }
        
        .attraction-item:hover .attraction-image img {
            transform: scale(1.05);
        }
        
        .attraction-content {
            flex: 0 0 60%;
            padding: 25px;
        }
        
        .attraction-content h3 {
            color: #e74c3c;
            margin-bottom: 10px;
            font-size: 24px;
        }
        
        .attraction-meta {
            display: flex;
            gap: 20px;
            color: #666;
            margin-bottom: 15px;
            font-size: 14px;
        }
        
        .attraction-meta span {
            display: flex;
            align-items: center;
        }
        
        .attraction-meta i {
            margin-right: 5px;
            color: #e74c3c;
        }
        
        .attraction-info {
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }
        
        .attraction-info p {
            margin-bottom: 5px;
        }
        
        /* 响应式调整 */
        @media (max-width: 992px) {
            .category-nav {
                flex-wrap: wrap;
            }
            
            .attraction-item {
                flex-direction: column;
            }
            
            .attraction-image {
                flex: 0 0 auto;
                height: 250px;
            }
            
            .attraction-content {
                flex: 0 0 auto;
            }
        }
        
        @media (max-width: 768px) {
            .page-header h1 {
                font-size: 28px;
            }
            
            .page-header p {
                font-size: 16px;
            }
            
            .category-icon {
                width: 60px;
                height: 60px;
                font-size: 24px;
            }
        }
    </style>
</head>
<body>
    <!-- 页面加载动画 -->
    <div class="page-loader">
        <div class="loader"></div>
    </div>

    <!-- 用户小部件 -->
    <div class="user-widget">
        <a href="login.html" id="login-link" class="btn btn-login">登录/注册</a>
        <div id="user-profile" style="display: none;">
            <img src="img/attractions/touxiang.jpg" alt="User Avatar" class="avatar">
            <span id="username-display"></span>
            <a href="#" id="logout-link" title="退出登录"><i class="fas fa-sign-out-alt"></i></a>
        </div>
    </div>

    <!-- 浮动导航菜单 -->
    <div class="float-nav">
        <button class="float-nav-toggle" id="floatNavToggle" title="快速导航">
            <i class="fas fa-bars"></i>
        </button>
        <div class="float-nav-menu" id="floatNavMenu">
            <ul>
                <li><a href="index.html">首页</a></li>
                <li><a href="jingdian.html" class="active">景点介绍</a></li>
                <li><a href="luxian.html">旅游线路</a></li>
                <li><a href="gonglue.html">旅游攻略</a></li>
                <li><a href="meishi.html">美食推荐</a></li>
                <li><a href="wenhua.html">汉文化活动</a></li>
                <li><a href="contact.html">联系我们</a></li>
                <li><a href="faq.html">常见问题</a></li>
            </ul>
        </div>
    </div>

    <!-- 导航栏 -->
    <nav>
        <div class="container">
            <div class="nav-container">
                <div class="nav-logo">
                    <a href="index.html">
                        <img src="img/attractions/logo.jpg" alt="汉中旅游" class="nav-logo-img">
                        <h2>汉中旅游</h2>
                    </a>
                </div>
                <ul class="main-nav">
                    <li><a href="index.html">首页</a></li>
                    <li><a href="jingdian.html" class="active">景点介绍</a></li>
                    <li><a href="luxian.html">旅游线路</a></li>
                    <li><a href="gonglue.html">旅游攻略</a></li>
                    <li><a href="meishi.html">美食推荐</a></li>
                    <li><a href="wenhua.html">汉文化活动</a></li>
                    <li><a href="contact.html">联系我们</a></li>
                    <li><a href="faq.html">常见问题</a></li>
                </ul>
                <!-- 用户操作区域已被移到独立的 user-widget 中 -->
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <main>
        <!-- 页面头部 -->
        <section class="page-header">
            <div class="container">
                <h1>汉中景点介绍</h1>
                <p>探索汉中的自然风光、历史古迹和文化景观</p>
            </div>
        </section>

        <!-- 景点分类导航 -->
        <section class="container">
            <div class="category-nav">
                <a href="#natural" class="category-link">
                    <div class="category-icon"><i class="fas fa-mountain"></i></div>
                    <span>自然风光</span>
                </a>
                <a href="#historical" class="category-link">
                    <div class="category-icon"><i class="fas fa-landmark"></i></div>
                    <span>历史古迹</span>
                </a>
                <a href="#cultural" class="category-link">
                    <div class="category-icon"><i class="fas fa-theater-masks"></i></div>
                    <span>文化景观</span>
                </a>
            </div>
        </section>

        <!-- 自然风光 -->
        <section id="natural" class="container section-padding">
            <h2 class="section-title">自然风光</h2>
            <div class="attractions-grid" id="natural-attractions">
                <!-- 自然风光景点数据将通过API动态加载 -->
                <div class="loading-placeholder">
                    <i class="fas fa-spinner fa-spin"></i>
                    <p>正在加载自然风光景点...</p>
                </div>
            </div>
        </section>

        <!-- 历史古迹 -->
        <section id="historical" class="container section-padding">
            <h2 class="section-title">历史古迹</h2>
            <div class="attractions-grid" id="historical-attractions">
                <!-- 历史古迹景点数据将通过API动态加载 -->
                <div class="loading-placeholder">
                    <i class="fas fa-spinner fa-spin"></i>
                    <p>正在加载历史古迹景点...</p>
                </div>
            </div>
        </section>

        <!-- 文化景观 -->
        <section id="cultural" class="container section-padding">
            <h2 class="section-title">文化景观</h2>
            <div class="attractions-grid" id="cultural-attractions">
                <!-- 文化景观景点数据将通过API动态加载 -->
                <div class="loading-placeholder">
                    <i class="fas fa-spinner fa-spin"></i>
                    <p>正在加载文化景观景点...</p>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3>关于我们</h3>
                    <p>汉中旅游网致力于为游客提供最全面的汉中旅游信息，让您的汉中之行更加便捷、愉快。</p>
                    <div class="social-links">
                        <a href="#"><i class="fab fa-weibo"></i></a>
                        <a href="#"><i class="fab fa-weixin"></i></a>
                        <a href="#"><i class="fab fa-qq"></i></a>
                    </div>
                </div>
                <div class="footer-section">
                    <h3>快速链接</h3>
                    <ul>
                        <li><a href="index.html">首页</a></li>
                        <li><a href="jingdian.html">景点介绍</a></li>
                        <li><a href="luxian.html">旅游线路</a></li>
                        <li><a href="gonglue.html">旅游攻略</a></li>
                        <li><a href="contact.html">联系我们</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>热门景点</h3>
                    <ul>
                        <li><a href="#wuhoumu">武侯墓</a></li>
                        <li><a href="#nanhu">南湖</a></li>
                        <li><a href="#dingjunshan">定军山</a></li>
                        <li><a href="#guchengqiang">古城墙</a></li>
                        <li><a href="#qingmuchuan">青木川古镇</a></li>
                        <li><a href="#shimenzhandao">石门栈道</a></li>
                        <li><a href="#bowuguan">汉中市博物馆</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>联系方式</h3>
                    <p><i class="fas fa-map-marker-alt"></i> 地址：陕西省汉中市</p>
                    <p><i class="fas fa-phone"></i> 电话：18165245563</p>
                    <p><i class="fas fa-envelope"></i> 邮箱：1959847182@qq.com</p>
                </div>
            </div>
            <div class="footer-bottom">
                <p>&copy; 2025 汉中旅游网 版权所有</p>
            </div>
        </div>
    </footer>

    <script src="js/main.js"></script>
    <script src="js/script.js"></script>

    <!-- 引入API调用工具 -->
    <script src="js/api.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', async function() {
            // 获取所有锚点链接
            const anchorLinks = document.querySelectorAll('a[href^="#"]');
            
            // 为每个锚点链接添加点击事件
            anchorLinks.forEach(function(link) {
                link.addEventListener('click', function(e) {
                    e.preventDefault();
                    
                    // 获取目标元素的ID
                    const targetId = this.getAttribute('href');
                    
                    // 如果是空锚点或者页面顶部，直接滚动到顶部
                    if (targetId === '#' || targetId === '') {
                        window.scrollTo({
                            top: 0,
                            behavior: 'smooth'
                        });
                        return;
                    }
                    
                    // 获取目标元素
                    const targetElement = document.querySelector(targetId);
                    
                    // 如果目标元素存在，滚动到该元素
                    if (targetElement) {
                        // 获取元素的位置
                        const elementPosition = targetElement.getBoundingClientRect().top;
                        const offsetPosition = elementPosition + window.pageYOffset - 100; // 减去100px的偏移量，避免被导航栏遮挡
                        
                        // 平滑滚动到目标位置
                        window.scrollTo({
                            top: offsetPosition,
                            behavior: 'smooth'
                        });
                    }
                });
            });

            // 加载景点数据
            try {
                console.log('开始加载景点数据...');
                
                // 加载自然风光景点
                const naturalAttractions = await TravelAPI.getAttractionsByType('natural');
                console.log('自然风光景点数据:', naturalAttractions);
                if (naturalAttractions && naturalAttractions.length > 0) {
                    DataRenderer.renderAttractionsDetail(naturalAttractions, 'natural-attractions');
                } else {
                    document.getElementById('natural-attractions').innerHTML = 
                        '<div class="api-error"><i class="fas fa-info-circle"></i>暂无自然风光景点数据</div>';
                }
                
                // 加载历史古迹景点
                const historicalAttractions = await TravelAPI.getAttractionsByType('historical');
                console.log('历史古迹景点数据:', historicalAttractions);
                if (historicalAttractions && historicalAttractions.length > 0) {
                    DataRenderer.renderAttractionsDetail(historicalAttractions, 'historical-attractions');
                } else {
                    document.getElementById('historical-attractions').innerHTML = 
                        '<div class="api-error"><i class="fas fa-info-circle"></i>暂无历史古迹景点数据</div>';
                }
                
                // 加载文化景观景点
                const culturalAttractions = await TravelAPI.getAttractionsByType('cultural');
                console.log('文化景观景点数据:', culturalAttractions);
                if (culturalAttractions && culturalAttractions.length > 0) {
                    DataRenderer.renderAttractionsDetail(culturalAttractions, 'cultural-attractions');
                } else {
                    document.getElementById('cultural-attractions').innerHTML = 
                        '<div class="api-error"><i class="fas fa-info-circle"></i>暂无文化景观景点数据</div>';
                }
                
            } catch (error) {
                console.error('加载景点数据时发生错误:', error);
                
                // 显示错误信息
                ['natural-attractions', 'historical-attractions', 'cultural-attractions'].forEach(containerId => {
                    const container = document.getElementById(containerId);
                    if (container) {
                        container.innerHTML = 
                            '<div class="api-error"><i class="fas fa-exclamation-triangle"></i>加载景点数据失败</div>';
                    }
                });
            }
        });
    </script>
</body>
</html> 